import { ChatOllama } from "@langchain/ollama";
import { PromptTemplate } from "@langchain/core/prompts";
import { StringOutputParser } from "@langchain/core/output_parsers";
import { MODEL, TEMPERATURE } from "./config.js";

// 创建模块
const prompt = PromptTemplate.fromTemplate("请使用中文解释：{topic}");
const model = new ChatOllama({ model: MODEL, temperature: TEMPERATURE });
const parser = new StringOutputParser();

export const chain = prompt.pipe(model).pipe(parser);
